﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Reflection;
using ScrumTable.Common.Logging;

namespace ScrumTable.Tools.ErrorReporter
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : System.Windows.Application
    {
        private void InitializeLogging()
        {
            Logger<App>.SurroundInfo(
                ScrumTable.Tools.ErrorReporter.Properties.Resources.LogInitializeLogging,
                ScrumTable.Tools.ErrorReporter.Properties.Resources.LogInitializeLoggingCompleted,
                () =>
                {
                    LoggerConfig.RegisterConfigFile("Logging/LoggingConfig.xml");
                });
        }

        protected override void OnStartup(System.Windows.StartupEventArgs eventArgs)
        {
            InitializeLogging();

            Logger<App>.SurroundInfo(
                string.Format(ScrumTable.Tools.ErrorReporter.Properties.Resources.LogStartUp, Assembly.GetExecutingAssembly().GetName().Version),
                string.Format(ScrumTable.Tools.ErrorReporter.Properties.Resources.LogStartUpCompleted, Assembly.GetExecutingAssembly().GetName().Version),
                () =>
                {
                    base.OnStartup(eventArgs);
                });
        }
    }
}
